<?php

use yii\helpers\Html;
use yii\widgets\DetailView;

/** @var $model \common\models\c2\entity\SalesOrder */
$this->title = '销售订单打印'
?>

<style>
    .tc {text-align: center}
</style>

<div class="container-fluid">

    <div class="tc">
        <h2 style="font-size: 30px;">中山市祥丰（帕奇）家居用品有限公司</h2>
        <h2 style="font-size: 20px;">ZHONG SHAN XIANG FENG HOUSEWARE (PA QI)Co.,LTD</h2>
        <h5 style="font-size: 18px;">销售订单</h5>
    </div>


    <div class="row">
        <div class="col-4">客户：<?= !is_null($model->customer) ? $model->customer->username : '' ?></div>
        <div class="col-4">PO.NO:<?= $model->code ?></div>
        <div class="col-4">排产日期：<?= date('Y-m-d', strtotime($model->production_date)) ?></div>
    </div>

    <div class="row">
        <div class="col-4">出货日期：<?= date('Y-m-d', strtotime($model->delivery_date)) ?></div>
    </div>

    <table class="table table-bordered mt10">

        <tr class="tc">
            <td>产品编号</td>
            <td>产品名称</td>
            <td>型号</td>
            <td>包装</td>
            <td>件数</td>
            <td>数量</td>
            <td>单价</td>
            <td>小计</td>
            <!--        <td class="box120">尺码</td>-->
            <!--        <td class="box120">毛重</td>-->
            <!--        <td class="box120">净重</td>-->
            <td class="memo">备注</td>
        </tr>

        <?php
        $orderItems = $model->getOrderItems()->with('product', 'package', 'productSku')->all();
        ?>

        <?php foreach ($orderItems as $item): ?>
            <tr class="tc">
                <td><?= $item->product->sku ?></td>
                <td><?= $item->product->name ?></td>
                <td><?= $item->productSku->label ?></td>
                <td><?= $item->package->label ?></td>
                <td><?= $item->pieces ?></td>
                <td><?= $item->quantity ?></td>
                <td><?= $item->price ?></td>
                <td><?= $item->subtotal ?></td>
                <td><?= $item->memo ?></td>
            </tr>

        <?php endforeach; ?>

    </table>

    <div>
        <?= $model->memo ?>
    </div>

</div>

